<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="EventDataSet" targetNamespace="http://tempuri.org/EventDataSet.xsd" xmlns:mstns="http://tempuri.org/EventDataSet.xsd" xmlns="http://tempuri.org/EventDataSet.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
  <xs:annotation>
    <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
      <DataSource DefaultConnectionIndex="1" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
        <Connections>
          <Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="SocialNetworkConnectionString" ConnectionStringObject="" IsAppSettingsProperty="True" Modifier="Assembly" Name="SocialNetworkConnectionString (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.WLQuickApps.SocialNetwork.Data.Properties.Settings.GlobalReference.Default.SocialNetworkConnectionString" Provider="System.Data.SqlClient">
          </Connection>
        </Connections>
        <Tables>
          <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="EventTableAdapter" GeneratorDataComponentClassName="EventTableAdapter" Name="Event" UserDataComponentName="EventTableAdapter">
            <MainSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="[SocialNetwork].dbo.Event" DbObjectType="Table" GenerateMethods="Get" GenerateShortCommands="False" GeneratorGetMethodName="Get" GetMethodModifier="Public" GetMethodName="Get" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="False" UserGetMethodName="Get" UserSourceName="Get">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT        BaseItemID, StartTime, EndTime
FROM            Event</CommandText>
                    <Parameters>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
            </MainSource>
            <Mappings>
              <Mapping SourceColumn="StartTime" DataSetColumn="StartTime" />
              <Mapping SourceColumn="EndTime" DataSetColumn="EndTime" />
              <Mapping SourceColumn="GroupBaseItemID" DataSetColumn="BaseItemID" />
              <Mapping SourceColumn="BaseItemID" DataSetColumn="BaseItemID" />
            </Mappings>
            <Sources>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateShortCommands="True" GeneratorSourceName="CreateEvent" Modifier="Public" Name="CreateEvent" QueryType="Scalar" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetDataBy" UserSourceName="CreateEvent">
                <InsertCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>INSERT INTO Event
                         (BaseItemID, StartTime, EndTime)
VALUES        (@baseItemID,@startTime,@endTime); 

SELECT SCOPE_IDENTITY()</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="baseItemID" ColumnName="BaseItemID" DataSourceName="[SocialNetwork].dbo.Event" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@baseItemID" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="BaseItemID" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="startTime" ColumnName="StartTime" DataSourceName="[SocialNetwork].dbo.Event" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@startTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="endTime" ColumnName="EndTime" DataSourceName="[SocialNetwork].dbo.Event" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@endTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="EndTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </InsertCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="True" GeneratorGetMethodName="GetEventsByBaseItemIDForDateRange" GeneratorSourceName="FillBy" GetMethodModifier="Public" GetMethodName="GetEventsByBaseItemIDForDateRange" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetEventsByBaseItemIDForDateRange" UserSourceName="FillBy">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>WITH PageTable AS 
(SELECT        Event.BaseItemID, Event.StartTime, Event.EndTime, ROW_NUMBER() OVER (ORDER BY Event.StartTime) AS RowID
FROM            Event INNER JOIN
                         BaseItemAssociation ON Event.BaseItemID = BaseItemAssociation.AssociatedBaseItemID
WHERE        (BaseItemAssociation.BaseItemID = @baseItemID) AND ((Event.StartTime BETWEEN @startTime AND @endTime) OR
                         (Event.EndTime BETWEEN @startTime AND @endTime) OR
                         ((@startTime BETWEEN Event.StartTime AND Event.EndTime) AND (@endTime BETWEEN Event.StartTime AND Event.EndTime)))
)
                             SELECT        *
                              FROM            PageTable
                              WHERE        RowID BETWEEN (@startRowIndex + 1) AND (@startRowIndex + @maximumRows)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="" ColumnName="BaseItemID" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@baseItemID" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="BaseItemID" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" ColumnName="StartTime" DataSourceName="" DbType="DateTime" Direction="Input" ParameterName="@startTime" Precision="0" ProviderType="DateTime" Scale="0" Size="0" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" ColumnName="EndTime" DataSourceName="" DbType="DateTime" Direction="Input" ParameterName="@endTime" Precision="0" ProviderType="DateTime" Scale="0" Size="0" SourceColumn="EndTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@startRowIndex" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@maximumRows" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="True" GeneratorGetMethodName="GetAllEvents" GetMethodModifier="Public" GetMethodName="GetAllEvents" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetAllEvents" UserSourceName="GetAllEvents1">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>WITH PageTable AS
(
SELECT        Event.BaseItemID, Event.StartTime, Event.EndTime

		, ROW_NUMBER() over (order by Event.StartTime) as RowID

FROM            Event
Where Event.StartTime &gt; CURRENT_TIMESTAMP

)

select * from PageTable
where RowID between (@startRowIndex + 1) and (@startRowIndex + @maximumRows)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@startRowIndex" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@maximumRows" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectType="Unknown" GenerateShortCommands="True" GeneratorSourceName="GetAllEventsCount" Modifier="Public" Name="GetAllEventsCount" QueryType="Scalar" ScalarCallRetval="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetDataBy1" UserSourceName="GetAllEventsCount">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT COUNT(*) FROM Event WHERE Event.StartTime &gt; CURRENT_TIMESTAMP</CommandText>
                    <Parameters>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="True" GeneratorGetMethodName="GetAllEventsForUserForDateRange" GeneratorSourceName="FillBy1" GetMethodModifier="Public" GetMethodName="GetAllEventsForUserForDateRange" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetAllEventsForUserForDateRange" UserSourceName="GetAllEventsForUserForDateRange1">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>WITH PageTable AS
(
SELECT        Event.BaseItemID, Event.EndTime, Event.StartTime

		, ROW_NUMBER() over (ORDER BY Event.StartTime) as RowID

FROM            Event INNER JOIN
                         UserGroup ON Event.BaseItemID = UserGroup.BaseItemID INNER JOIN
                         BaseItem ON Event.BaseItemID = [BaseItem].BaseItemID
WHERE        (UserGroup.UserID = @userID) AND (Event.StartTime BETWEEN @startTime AND @endTime) OR
                         (UserGroup.UserID = @userID) AND (Event.EndTime BETWEEN @startTime AND @endTime) OR
                         (UserGroup.UserID = @userID) AND (@startTime BETWEEN Event.StartTime AND Event.EndTime) AND (@endTime BETWEEN Event.StartTime AND 
                         Event.EndTime) AND (UserGroup.IsInviteAccepted = @isInviteAccepted) AND 
                         (UserGroup.IsApprovedByOwner = @isApprovedByOwner)

)

select * from PageTable
where RowID between (@startRowIndex + 1) and (@startRowIndex + @maximumRows)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="userID" ColumnName="UserID" DataSourceName="" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@userID" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="UserID" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="startTime" ColumnName="StartTime" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@startTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="endTime" ColumnName="StartTime" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@endTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="isInviteAccepted" ColumnName="IsInviteAccepted" DataSourceName="" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@isInviteAccepted" Precision="0" ProviderType="Bit" Scale="0" Size="1" SourceColumn="IsInviteAccepted" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="isApprovedByOwner" ColumnName="IsApprovedByOwner" DataSourceName="" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@isApprovedByOwner" Precision="0" ProviderType="Bit" Scale="0" Size="1" SourceColumn="IsApprovedByOwner" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@startRowIndex" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@maximumRows" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectType="Unknown" GenerateShortCommands="True" GeneratorSourceName="GetAllEventsForUserForDateRangeCount" Modifier="Public" Name="GetAllEventsForUserForDateRangeCount" QueryType="Scalar" ScalarCallRetval="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetDataBy2" UserSourceName="GetAllEventsForUserForDateRangeCount">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT COUNT(*)
FROM            Event INNER JOIN
                         UserGroup ON Event.BaseItemID = UserGroup.BaseItemID INNER JOIN
                         BaseItem ON Event.BaseItemID = [BaseItem].BaseItemID
WHERE        (UserGroup.UserID = @userID) AND 
(Event.StartTime BETWEEN @startTime AND @endTime) AND
(UserGroup.IsInviteAccepted = @isInviteAccepted) AND
(UserGroup.IsApprovedByOwner = @isApprovedByOwner)
</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="userID" ColumnName="UserID" DataSourceName="SocialNetwork.dbo.UserGroup" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@userID" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="UserID" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="startTime" ColumnName="StartTime" DataSourceName="SocialNetwork.dbo.Event" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@startTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="endTime" ColumnName="StartTime" DataSourceName="SocialNetwork.dbo.Event" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@endTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="isInviteAccepted" ColumnName="IsInviteAccepted" DataSourceName="SocialNetwork.dbo.UserGroup" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@isInviteAccepted" Precision="0" ProviderType="Bit" Scale="0" Size="1" SourceColumn="IsInviteAccepted" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="isApprovedByOwner" ColumnName="IsApprovedByOwner" DataSourceName="SocialNetwork.dbo.UserGroup" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@isApprovedByOwner" Precision="0" ProviderType="Bit" Scale="0" Size="1" SourceColumn="IsApprovedByOwner" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="True" GeneratorGetMethodName="GetAllEventsForUserStartingInDateRange" GetMethodModifier="Public" GetMethodName="GetAllEventsForUserStartingInDateRange" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetAllEventsForUserStartingInDateRange" UserSourceName="GetAllEventsForUserStartingInDateRange1">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>WITH PageTable AS
(
SELECT        Event.BaseItemID, Event.EndTime, Event.StartTime

		, ROW_NUMBER() over (ORDER BY Event.StartTime) as RowID

FROM            Event INNER JOIN
                         UserGroup ON Event.BaseItemID = UserGroup.BaseItemID INNER JOIN
                         BaseItem ON Event.BaseItemID = [BaseItem].BaseItemID
WHERE        (UserGroup.UserID = @userID) AND (Event.StartTime BETWEEN @startTime AND @endTime) AND
(UserGroup.IsInviteAccepted = @isInviteAccepted) AND 
                         (UserGroup.IsApprovedByOwner = @isApprovedByOwner)

)

select * from PageTable
where RowID between (@startRowIndex + 1) and (@startRowIndex + @maximumRows)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="userID" ColumnName="UserID" DataSourceName="" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@userID" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="UserID" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="startTime" ColumnName="StartTime" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@startTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="endTime" ColumnName="StartTime" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@endTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="isInviteAccepted" ColumnName="IsInviteAccepted" DataSourceName="" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@isInviteAccepted" Precision="0" ProviderType="Bit" Scale="0" Size="1" SourceColumn="IsInviteAccepted" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="isApprovedByOwner" ColumnName="IsApprovedByOwner" DataSourceName="" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@isApprovedByOwner" Precision="0" ProviderType="Bit" Scale="0" Size="1" SourceColumn="IsApprovedByOwner" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@startRowIndex" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@maximumRows" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectType="Unknown" GenerateShortCommands="True" GeneratorSourceName="GetAllEventsForUserStartingInDateRangeCount" Modifier="Public" Name="GetAllEventsForUserStartingInDateRangeCount" QueryType="Scalar" ScalarCallRetval="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetDataBy3" UserSourceName="GetAllEventsForUserStartingInDateRangeCount">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT COUNT(*)
FROM            Event INNER JOIN
                         UserGroup ON Event.BaseItemID = UserGroup.BaseItemID INNER JOIN
                         BaseItem ON Event.BaseItemID = [BaseItem].BaseItemID
WHERE        (UserGroup.UserID = @userID) AND (Event.StartTime BETWEEN @startTime AND @endTime) AND (UserGroup.IsInviteAccepted = @isInviteAccepted) AND 
                         (UserGroup.IsApprovedByOwner = @isApprovedByOwner)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="userID" ColumnName="UserID" DataSourceName="SocialNetwork.dbo.UserGroup" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@userID" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="UserID" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="startTime" ColumnName="StartTime" DataSourceName="SocialNetwork.dbo.Event" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@startTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="endTime" ColumnName="StartTime" DataSourceName="SocialNetwork.dbo.Event" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@endTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="isInviteAccepted" ColumnName="IsInviteAccepted" DataSourceName="SocialNetwork.dbo.UserGroup" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@isInviteAccepted" Precision="0" ProviderType="Bit" Scale="0" Size="1" SourceColumn="IsInviteAccepted" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="isApprovedByOwner" ColumnName="IsApprovedByOwner" DataSourceName="SocialNetwork.dbo.UserGroup" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@isApprovedByOwner" Precision="0" ProviderType="Bit" Scale="0" Size="1" SourceColumn="IsApprovedByOwner" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="True" GeneratorGetMethodName="GetAllUpcomingEventsForToday" GetMethodModifier="Public" GetMethodName="GetAllUpcomingEventsForToday" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetAllUpcomingEventsForToday" UserSourceName="GetAllUpcomingEventsForToday1">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>WITH PageTable AS
(
SELECT Event.BaseItemID, Event.EndTime, Event.StartTime

		, ROW_NUMBER() over (ORDER BY Event.StartTime) as RowID

FROM Event 
INNER JOIN BaseItem ON Event.BaseItemID = BaseItem.BaseItemID 

WHERE (Event.StartTime BETWEEN CURRENT_TIMESTAMP AND DATEADD(day, DATEDIFF(day, 0, CURRENT_TIMESTAMP), 1)) 

)

select * from PageTable
where RowID between (@startRowIndex + 1) and (@startRowIndex + @maximumRows)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@startRowIndex" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@maximumRows" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectType="Unknown" GenerateShortCommands="True" GeneratorSourceName="GetAllUpcomingEventsForTodayCount" Modifier="Public" Name="GetAllUpcomingEventsForTodayCount" QueryType="Scalar" ScalarCallRetval="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetDataBy4" UserSourceName="GetAllUpcomingEventsForTodayCount">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT COUNT(*)
FROM Event 
INNER JOIN BaseItem ON Event.BaseItemID = BaseItem.BaseItemID 

WHERE (Event.StartTime BETWEEN CURRENT_TIMESTAMP AND DATEADD(day, DATEDIFF(day, 0, CURRENT_TIMESTAMP), 1)) </CommandText>
                    <Parameters>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="[SocialNetwork].dbo.Event" DbObjectType="Table" GenerateMethods="Get" GenerateShortCommands="True" GeneratorGetMethodName="GetEvent" GetMethodModifier="Public" GetMethodName="GetEvent" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetEvent" UserSourceName="GetEvent1">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT BaseItemID, EndTime, StartTime FROM Event WHERE (BaseItemID = @baseItemID)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="baseItemID" ColumnName="BaseItemID" DataSourceName="" DataTypeServer="unknown" DbType="Object" Direction="Input" ParameterName="@baseItemID" Precision="0" Scale="0" Size="1024" SourceColumn="BaseItemID" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="True" GeneratorGetMethodName="GetEventsByBaseItemID" GetMethodModifier="Public" GetMethodName="GetEventsByBaseItemID" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetEventsByBaseItemID" UserSourceName="GetEventsByBaseItemID1">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>WITH PageTable AS (SELECT        Event.BaseItemID, Event.StartTime, Event.EndTime, ROW_NUMBER() OVER (ORDER BY Event.StartTime) AS RowID
FROM            Event INNER JOIN
                         BaseItemAssociation ON Event.BaseItemID = BaseItemAssociation.AssociatedBaseItemID
WHERE        (BaseItemAssociation.BaseItemID = @baseItemID) AND Event.StartTime &gt; CURRENT_TIMESTAMP)
    SELECT        *
     FROM            PageTable
     WHERE        RowID BETWEEN (@startRowIndex + 1) AND (@startRowIndex + @maximumRows)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@baseItemID" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@startRowIndex" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@maximumRows" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectType="Unknown" GenerateShortCommands="True" GeneratorSourceName="GetEventsByBaseItemIDCount" Modifier="Public" Name="GetEventsByBaseItemIDCount" QueryType="Scalar" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetDataBy5" UserSourceName="GetEventsByBaseItemIDCount">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT        COUNT(*) AS Expr1
FROM            Event INNER JOIN
                         BaseItemAssociation ON Event.BaseItemID = BaseItemAssociation.AssociatedBaseItemID
WHERE        (BaseItemAssociation.BaseItemID = @baseItemID) AND (Event.StartTime &gt; CURRENT_TIMESTAMP)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="baseItemID" ColumnName="BaseItemID" DataSourceName="SocialNetwork.dbo.BaseItemAssociation" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@baseItemID" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="BaseItemID" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectType="Unknown" GenerateShortCommands="True" GeneratorGetMethodName="GetDataBy11" GeneratorSourceName="GetEventsByBaseItemIDForDateRangeCount" Modifier="Public" Name="GetEventsByBaseItemIDForDateRangeCount" QueryType="Scalar" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetDataBy11" UserSourceName="GetEventsByBaseItemIDForDateRangeCount">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT        COUNT(*) AS Expr1
FROM            Event INNER JOIN
                         BaseItemAssociation ON Event.BaseItemID = BaseItemAssociation.AssociatedBaseItemID
WHERE   (BaseItemAssociation.BaseItemID = @baseItemID) AND ((Event.StartTime BETWEEN @startTime AND @endTime) OR
                         (Event.EndTime BETWEEN @startTime AND @endTime) OR
                         ((@startTime BETWEEN Event.StartTime AND Event.EndTime) AND (@endTime BETWEEN Event.StartTime AND Event.EndTime)))
</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="baseItemID" ColumnName="BaseItemID" DataSourceName="SocialNetwork.dbo.BaseItemAssociation" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@baseItemID" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="BaseItemID" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="startTime" ColumnName="StartTime" DataSourceName="SocialNetwork.dbo.Event" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@startTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="endTime" ColumnName="StartTime" DataSourceName="SocialNetwork.dbo.Event" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@endTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectType="Unknown" GenerateShortCommands="True" GeneratorSourceName="GetEventsForOwnerCount" Modifier="Public" Name="GetEventsForOwnerCount" QueryType="Scalar" ScalarCallRetval="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetDataBy6" UserSourceName="GetEventsForOwnerCount">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT COUNT(Event.BaseItemID) FROM Event
INNER JOIN [BaseItem]
ON BaseItem.BaseItemID = [Event].BaseItemID
WHERE OwnerUserID = @ownerUserID</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="ownerUserID" ColumnName="" DataSourceName="" DataTypeServer="unknown" DbType="Object" Direction="Input" ParameterName="@ownerUserID" Precision="0" Scale="0" Size="1024" SourceColumn="" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="True" GeneratorGetMethodName="GetEventsForUser" GeneratorSourceName="FillBy" GetMethodModifier="Public" GetMethodName="GetEventsForUser" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetEventsForUser" UserSourceName="GetEventsForUser1">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>WITH PageTable AS (SELECT        Event.EndTime, Event.BaseItemID, Event.StartTime, ROW_NUMBER() OVER (ORDER BY Event.StartTime) AS RowID
FROM            Event INNER JOIN
                         BaseItem ON Event.BaseItemID = BaseItem.BaseItemID INNER JOIN
                         UserGroup ON Event.BaseItemID = UserGroup.BaseItemID
WHERE        (UserGroup.UserID = @userID) AND (UserGroup.IsInviteAccepted = @isInviteAccepted) AND (UserGroup.IsApprovedByOwner = @isApprovedByOwner) AND 
                         Event.StartTime &gt; CURRENT_TIMESTAMP)
    SELECT        *
     FROM            PageTable
     WHERE        RowID BETWEEN (@startRowIndex + 1) AND (@startRowIndex + @maximumRows)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="userID" ColumnName="UserID" DataSourceName="" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@userID" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="UserID" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="isInviteAccepted" ColumnName="IsInviteAccepted" DataSourceName="" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@isInviteAccepted" Precision="0" ProviderType="Bit" Scale="0" Size="1" SourceColumn="IsInviteAccepted" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="isApprovedByOwner" ColumnName="IsApprovedByOwner" DataSourceName="" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@isApprovedByOwner" Precision="0" ProviderType="Bit" Scale="0" Size="1" SourceColumn="IsApprovedByOwner" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@startRowIndex" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@maximumRows" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectType="Unknown" GenerateShortCommands="True" GeneratorSourceName="GetEventsForUserCount" Modifier="Public" Name="GetEventsForUserCount" QueryType="Scalar" ScalarCallRetval="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetDataBy7" UserSourceName="GetEventsForUserCount">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT        COUNT(*) AS Expr1
FROM            Event INNER JOIN
                         BaseItem ON Event.BaseItemID = BaseItem.BaseItemID INNER JOIN
                         UserGroup ON Event.BaseItemID = UserGroup.BaseItemID
WHERE        (UserGroup.UserID = @userID) AND (UserGroup.IsInviteAccepted = @isInviteAccepted) AND (UserGroup.IsApprovedByOwner = @isApprovedByOwner) AND 
                         (Event.StartTime &gt; CURRENT_TIMESTAMP)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="userID" ColumnName="UserID" DataSourceName="SocialNetwork.dbo.UserGroup" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@userID" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="UserID" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="isInviteAccepted" ColumnName="IsInviteAccepted" DataSourceName="SocialNetwork.dbo.UserGroup" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@isInviteAccepted" Precision="0" ProviderType="Bit" Scale="0" Size="1" SourceColumn="IsInviteAccepted" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="isApprovedByOwner" ColumnName="IsApprovedByOwner" DataSourceName="SocialNetwork.dbo.UserGroup" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@isApprovedByOwner" Precision="0" ProviderType="Bit" Scale="0" Size="1" SourceColumn="IsApprovedByOwner" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="True" GeneratorGetMethodName="GetUpcomingEventsForToday" GetMethodModifier="Public" GetMethodName="GetUpcomingEventsForToday" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetUpcomingEventsForToday" UserSourceName="GetUpcomingEventsForToday1">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>WITH PageTable AS
(
SELECT Event.BaseItemID, Event.EndTime, Event.StartTime

		, ROW_NUMBER() over (ORDER BY Event.StartTime) as RowID

FROM Event 
INNER JOIN BaseItem ON Event.BaseItemID = BaseItem.BaseItemID 

WHERE (Event.StartTime BETWEEN CURRENT_TIMESTAMP AND DATEADD(day, DATEDIFF(day, 0, CURRENT_TIMESTAMP), 1)) 
AND (BaseItem.SubType = @eventType)
)

select * from PageTable
where RowID between (@startRowIndex + 1) and (@startRowIndex + @maximumRows)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="eventType" ColumnName="" DataSourceName="" DataTypeServer="unknown" DbType="Object" Direction="Input" ParameterName="@eventType" Precision="0" Scale="0" Size="1024" SourceColumn="" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@startRowIndex" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@maximumRows" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectType="Unknown" GenerateShortCommands="True" GeneratorSourceName="GetUpcomingEventsForTodayCount" Modifier="Public" Name="GetUpcomingEventsForTodayCount" QueryType="Scalar" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetDataBy8" UserSourceName="GetUpcomingEventsForTodayCount">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT COUNT(*) 
FROM Event 
INNER JOIN BaseItem ON Event.BaseItemID = BaseItem.BaseItemID 

WHERE (Event.StartTime BETWEEN CURRENT_TIMESTAMP AND DATEADD(day, DATEDIFF(day, 0, CURRENT_TIMESTAMP), 1)) 
AND (BaseItem.SubType = @eventType)
</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="eventType" ColumnName="SubType" DataSourceName="SocialNetwork.dbo.BaseItem" DataTypeServer="varchar(50)" DbType="AnsiString" Direction="Input" ParameterName="@eventType" Precision="0" ProviderType="VarChar" Scale="0" Size="50" SourceColumn="SubType" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="True" GeneratorGetMethodName="SearchEventsWithDateRange" GetMethodModifier="Public" GetMethodName="SearchEventsWithDateRange" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="SearchEventsWithDateRange" UserSourceName="SearchEventsWithDateRange1">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>WITH PageTable AS
(
SELECT Event.BaseItemID, Event.EndTime, Event.StartTime 

		, ROW_NUMBER() over (ORDER BY Event.StartTime) as RowID

FROM Event INNER JOIN [Group] ON Event.BaseItemID = [Group].BaseItemID 
INNER JOIN BaseItem ON [Group].BaseItemID = BaseItem.BaseItemID 
INNER JOIN Location ON BaseItem.LocationID = Location.LocationID 

WHERE 
(Event.StartTime BETWEEN @startTime AND @endTime) 
AND (BaseItem.TagList LIKE @tagList) 
AND (Location.SearchData LIKE @locationSearchData) 

)

select * from PageTable
where RowID between (@startRowIndex + 1) and (@startRowIndex + @maximumRows)
</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="startTime" ColumnName="StartTime" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@startTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="endTime" ColumnName="StartTime" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@endTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="tagList" ColumnName="TagList" DataSourceName="" DataTypeServer="text" DbType="AnsiString" Direction="Input" ParameterName="@tagList" Precision="0" ProviderType="Text" Scale="0" Size="2147483647" SourceColumn="TagList" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="True" AutogeneratedName="locationSearchData" ColumnName="SearchData" DataSourceName="" DataTypeServer="varchar(256)" DbType="AnsiString" Direction="Input" ParameterName="@locationSearchData" Precision="0" ProviderType="VarChar" Scale="0" Size="256" SourceColumn="SearchData" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@startRowIndex" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@maximumRows" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectType="Unknown" GenerateShortCommands="True" GeneratorSourceName="SearchEventsWithDateRangeCount" Modifier="Public" Name="SearchEventsWithDateRangeCount" QueryType="Scalar" ScalarCallRetval="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetDataBy9" UserSourceName="SearchEventsWithDateRangeCount">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT COUNT(*) 
FROM Event INNER JOIN [Group] ON Event.BaseItemID = [Group].BaseItemID 
INNER JOIN BaseItem ON [Group].BaseItemID = BaseItem.BaseItemID 
INNER JOIN Location ON BaseItem.LocationID = Location.LocationID 

WHERE 
(Event.StartTime BETWEEN @startTime AND @endTime) 
AND (BaseItem.TagList LIKE @tagList) 
AND (Location.SearchData LIKE @locationSearchData) 
</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="startTime" ColumnName="StartTime" DataSourceName="SocialNetwork.dbo.Event" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@startTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="endTime" ColumnName="StartTime" DataSourceName="SocialNetwork.dbo.Event" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@endTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="tagList" ColumnName="TagList" DataSourceName="SocialNetwork.dbo.BaseItem" DataTypeServer="text" DbType="AnsiString" Direction="Input" ParameterName="@tagList" Precision="0" ProviderType="Text" Scale="0" Size="2147483647" SourceColumn="TagList" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="locationSearchData" ColumnName="SearchData" DataSourceName="SocialNetwork.dbo.Location" DataTypeServer="varchar(256)" DbType="AnsiString" Direction="Input" ParameterName="@locationSearchData" Precision="0" ProviderType="VarChar" Scale="0" Size="256" SourceColumn="SearchData" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateShortCommands="True" GeneratorGetMethodName="GetDataBy4" GeneratorSourceName="UpdateEvent" Modifier="Public" Name="UpdateEvent" QueryType="NoData" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetDataBy10" UserSourceName="UpdateEvent">
                <UpdateCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>UPDATE Event SET StartTime = @startTime, EndTime = @endTime WHERE BaseItemID = @baseItemID</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="startTime" ColumnName="StartTime" DataSourceName="SocialNetwork.dbo.Event" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@startTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="StartTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="endTime" ColumnName="EndTime" DataSourceName="SocialNetwork.dbo.Event" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@endTime" Precision="0" ProviderType="DateTime" Scale="0" Size="8" SourceColumn="EndTime" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="baseItemID" ColumnName="BaseItemID" DataSourceName="SocialNetwork.dbo.Event" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@baseItemID" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="BaseItemID" SourceColumnNullMapping="False" SourceVersion="Original">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </UpdateCommand>
              </DbSource>
            </Sources>
          </TableAdapter>
        </Tables>
        <Sources>
        </Sources>
      </DataSource>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="EventDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="EventDataSet" msprop:Generator_DataSetName="EventDataSet">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Event" msprop:Generator_UserTableName="Event" msprop:Generator_RowDeletedName="EventRowDeleted" msprop:Generator_RowChangedName="EventRowChanged" msprop:Generator_RowClassName="EventRow" msprop:Generator_RowChangingName="EventRowChanging" msprop:Generator_RowEvArgName="EventRowChangeEvent" msprop:Generator_RowEvHandlerName="EventRowChangeEventHandler" msprop:Generator_TableClassName="EventDataTable" msprop:Generator_TableVarName="tableEvent" msprop:Generator_RowDeletingName="EventRowDeleting" msprop:Generator_TablePropName="Event">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="StartTime" msprop:Generator_UserColumnName="StartTime" msprop:Generator_ColumnVarNameInTable="columnStartTime" msprop:Generator_ColumnPropNameInRow="StartTime" msprop:Generator_ColumnPropNameInTable="StartTimeColumn" type="xs:dateTime" />
              <xs:element name="EndTime" msprop:Generator_UserColumnName="EndTime" msprop:Generator_ColumnVarNameInTable="columnEndTime" msprop:Generator_ColumnPropNameInRow="EndTime" msprop:Generator_ColumnPropNameInTable="EndTimeColumn" type="xs:dateTime" />
              <xs:element name="BaseItemID" msdata:ReadOnly="true" msdata:AutoIncrement="true" msprop:Generator_UserColumnName="BaseItemID" msprop:Generator_ColumnPropNameInRow="BaseItemID" msprop:Generator_ColumnVarNameInTable="columnBaseItemID" msprop:Generator_ColumnPropNameInTable="BaseItemIDColumn" type="xs:int" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
    <xs:unique name="Constraint1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//mstns:Event" />
      <xs:field xpath="mstns:BaseItemID" />
    </xs:unique>
  </xs:element>
</xs:schema>